<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>告警管理</title>
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
		<link rel="stylesheet" type="text/css" href="../../css/api.css" />
		<link rel="stylesheet" type="text/css" href="../../css/globle.css" />
		<script src="http://www.jq22.com/jquery/jquery-1.10.2.js"></script>
		<link rel="stylesheet" type="text/css" href="../../css/common.css" />
		<style>
			/*body {
				padding-top: 25px;
			}
			span {
				margin: 10px;
			}
			.Tabl {
				height: 50px;
				width: 88%;
				font-size: 14px;
				font-weight: bold;
				text-align: left;
				margin-left: 6%;
			}
			.Td1 {
				color: #B8B8B8;
				width: 110px;
			}
			.Td2 {
				color: #000000;
				text-align: left;
			}
			.Hr {
				height: 1px;
				width: 96%;
				background-color: #B8B8B8;
				margin-left: 2%;
			}
			.Butt {
				border: 1px solid #B8B8B8;
				border-radius: 20px;
				color: #FFFFFF;
				height: 17px;
				width: 17px;
				outline: none;
			}
			.TabImg {
				height: 150px;
				width: 96%;
				margin-left: 2%;
				border: 10px solid #D8D8D8;
			}
			.TdImg1 {
				height: 110px;
				width: 90px;
			}
			.TdImg2 {
				height: 110px;
				width: 90px;
			}
			.ButAdd {
				height: 110px;
				width: 100px;
				font-size: 100px;
				color: #FFFFFF;
				background-color: #B8B8B8;
			}
			.TabL {
				height: 75px;
				width: 88%;
				font-size: 16px;
				font-weight: bold;
				text-align: left;
				margin-left: 6%;
			}
			.ButL {
				height: 40px;
				width: 100%;
				background-color: #D0D0D0;
				position: fixed;
				bottom: 0;
			}
			.Td3 {
				text-align: center;
				width: 50%;
			}
			select {
				appearance: none;
				-moz-appearance: none;
				-webkit-appearance: none;
				border: none;
				background:none;
			}

			span {
				margin: 10px;
			}
			.Tabl {
				height: 50px;
				width: 88%;
				font-size: 14px;
				font-weight: bold;
				text-align: left;
				margin-left: 6%;
			}
			.Td1 {
				color: #B8B8B8;
				width: 110px;
			}
			.Td2 {
				color: #000000;
				text-align: left;
			}
			.Hr {
				height: 1px;
				width: 96%;
				background-color: #B8B8B8;
				margin-left: 2%;
			}
			.Butt {
				border: 1px solid #B8B8B8;
				border-radius: 20px;
				color: #FFFFFF;
				height: 17px;
				width: 17px;
				outline: none;
			}
			.TabImg {
				height: 150px;
				width: 96%;
				margin-left: 2%;
				border: 10px solid #D8D8D8;
			}
			.TdImg1 {
				height: 110px;
				width: 90px;
			}
			.TdImg2 {
				height: 110px;
				width: 90px;
			}
			.ButAdd {
				height: 110px;
				width: 100px;
				font-size: 100px;
				color: #FFFFFF;
				background-color: #B8B8B8;
			}
			.TabL {
				height: 75px;
				width: 88%;
				font-size: 16px;
				font-weight: bold;
				text-align: left;
				margin-left: 6%;
			}
			.ButL {
				height: 40px;
				width: 100%;
				background-color: #D0D0D0;
				position: fixed;
				bottom: 0;
			}
			.Td3 {
				text-align: center;
				width: 50%;
			}*/
			html, body {
				background-color: #F5F6F6;
			}
			ul {
				position: relative;
				width: 100%;
			}
			ul li {
				list-style: none;
			}
			ul li input {
				display: none;
			}
			ul li label {
				float: left;
				width: 50%;
				text-align: center;
				line-height: 34px;
				height: 35px;
				border-right: 0;
				box-sizing: border-box;
				cursor: pointer;
				transition: all .3s;
				background-color: #1abc9c;
				color: #fff;
			}
			ul li input:checked+ label {
				color: #000;
				background-color: #F5F6F6;
			}
			ul li:last-child label {
				border-right: 1px solid #1abc9c;
			}
			ul li .content {
				opacity: 0;
				visibility: hidden;
				position: absolute;
				left: 0;
				top: 31px;
				width: 100%;
				height: auto;
				box-sizing: border-box;
				transition: all .3s;
			}
			ul li .content table {
				width: 100%
			}
			ul li .content td {
				border-bottom: 1px solid #DFE0E0;
				height: 60px;
			}
			ul li .content td:nth-child(1) {
				padding-left: 10px;
			}
			ul li .content td:nth-child(1) p:nth-child(2) {
				color: #555555
			}
			ul li:nth-child(1) .content {
				background-color: #F5F6F6;
			}
			ul li:nth-child(2) .content {
				background-color: #F5F6F6;
			}
			ul li:nth-child(3) .content {
				background-color: #F5F6F6;
			}
			ul li input:checked~
			.content {
				opacity: 1;
				visibility: visible;
			}
			.Add {
				height: 40px;
				width: 96%;
				background-color: #1ABC9C;
				color: white;
				text-align: center;
				font-size: 15px;
				margin-top: 20px;
				outline: none;
			}
			.fontcolr {
				color: #cccccc
			}
			.clickfont {
				color: #72EDD1
			}
		</style>
	</head>
	<body>
		<ul>
			<li>
			<input id="tab1" type="radio" name="tab" checked>
			<label for="tab1">告警管理</label>
			<div class="content">
				<table id="qqq">
					<tr v-for="(todo, index) in todos">

						<td v-if="todo.level=='高级'">
							<p style="color: red" >
							级别：{{todo.level}}
							</p>
						<br>
						<p class="fontcolr">
							点位：{{todo.departProjectData.dataName}}
						</p></td>

						<td v-if="todo.level=='中级'">
							<p style="color: darkorange" >
								级别：{{todo.level}}
							</p>
							<br>
							<p class="fontcolr">
								点位：{{todo.departProjectData.dataName}}
							</p></td>

						<td v-if="todo.level=='正常'">
							<p style="color: green" >
								级别：{{todo.level}}
							</p>
							<br>
							<p class="fontcolr">
								点位：{{todo.departProjectData.dataName}}
							</p></td>


						<td width="100">
						<p>
						设定值：{{todo.setvalue}}
						</p>
						<br>
						<p class="fontcolr">
							当前值：{{todo.currentvalue}}
						</p></td>
					</tr>
				</table>
			</div>

		</li>
			<li>
				<input id="tab2"  type="radio" name="tab">
				<label for="tab2">统计管理</label>
				<div class="content">
					<table>
												 <tr >
														 <td >
																 <div id="container1" style="height: 200px;"></div>
														 </td>
													 </tr>
													<tr >
														 <td >
																 <div id="container2" style="height: 200px;"></div>
														 </td>
												 </tr>
												 <tr >
														 <td >

																 <div id="container3" style="height: 200px"></div>

														 </td>
													 </tr>
													<tr >
														 <td valign="top">
																 <table  >
																		<tr>
																				<td colspan="2"><span style="font-size:16px">年度汇总</span></td>
																		</tr>
																		 <tr>
																				 <td width="100px">高级</td>
																				 <td ><span id="gj"></span></td>
																		 </tr>
																		 <tr>
																				 <td>中级</td>
																				 <td ><span id="zj"></span></td>
																		 </tr>
																		 <tr>
																				 <td>正常</td>
																				 <td ><span id="zc"></span></td>
																		 </tr>

																 </table>

														 </td>
												 </tr>

										 </table>
				</div>
			</li>


	</body><script src="../../script/webuploader.min.js"></script>
	<script src="../../script/diyUpload.js"></script>
	<script src="../../script/common.js"></script>
	<script src="../../script/vue.js"></script>
	<script src="../../script/jquery.js"></script>
	<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts/dist/echarts.min.js"></script>
	<script type="text/javascript" src="../../script/api.js"></script>
	<script type="text/javascript">
		apiready = function() {
			//项目id
			var proid = $api.getStorage('userSession').data.proId;
			search()
			//告警管理
			var app = new Vue({
				el : '#qqq',
				data : {
					todos : []
				},
				created : function() {
					$.ajax({
						type : "post",
						//async : false, //同步执行
						url : BaseServiceUrl+"mobile/alarm/list.json",
						data : {
							proid : proid
						},
						dataType : "json", //返回数据形式为json
						success : function(result) {
							for (var i = 0; i < result.data.length; i++) {
								app.todos.push(result.data[i]);
							}
						}
					});
				}
			})
		};


		function search(){
			//项目id
			var proid = $api.getStorage('userSession').data.proId;

		// 本年逐月
		        $.ajax({
		            url: BaseServiceUrl+"mobile/alarm/all.json",
		            type: "POST",
		            data: {
	proid : proid
		            },
		            dataType: "json",
		            success: function (ret) {
		                var gjsl=ret.data;
		                gjsl = eval("(" + gjsl + ")");
		                var zjsl=ret.datas;
		                zjsl = eval("(" +  zjsl + ")");
		                var zcsl=ret.data1;
		                zcsl = eval("(" +  zcsl + ")");
		var gj=0;var zj=0;var zc=0;
		                for(var i=0;i<12;i++){
		                    gj+=gjsl[i];
		                    zj+=zjsl[i];
		                    zc+=zcsl[i];
		                }
		                $("#gj").text(gj);
		                $("#zj").text(zj);
		                $("#zc").text(zc);
		//柱形图
		                var dom = document.getElementById("container1");
		                var myChart = echarts.init(dom);
		                var app = {};
		                option = null;
		                var colors = ['#5793f3', '#d14a61', '#675bba'];

		                option = {
		                    title: {
		                        text: '',
		                        left: 'left'
		                    },
		                    color: colors,

		                    tooltip: {
		                        trigger: 'axis',
		                        axisPointer: {
		                            type: 'cross'
		                        }
		                    },
		                    grid: {
		                        right: '20%'
		                    },
		                    toolbox: {
		                        feature: {
		                            dataView: {show: true, readOnly: false},
		                            restore: {show: true},
		                            saveAsImage: {show: true}
		                        }
		                    },
		                    legend: {
		                        data: ['高级','中级','正常']
		                    },
		                    xAxis: [
		                        {
		                            type: 'category',
		                            axisTick: {
		                                alignWithLabel: true
		                            },
		                            data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
		                        }
		                    ],
		                    yAxis: [
		                        {
		                            type: 'value',
		                            name: '数量',
		                            position: 'left',
		                            axisLine: {
		                                lineStyle: {
		                                    color: colors[0]
		                                }
		                            },
		                            axisLabel: {
		                                formatter: '{value} '
		                            }
		                        },

		                    ],
		                    series: [
		                        {
		                            name: '高级',
		                            type: 'bar',
		                            data: gjsl
		                        },
		                        {
		                            name: '中级',
		                            type: 'bar',
		                            data: zjsl
		                        },
		                        {
		                            name: '正常',
		                            type: 'bar',
		                            data: zcsl
		                        },



		                    ]
		                };

		                if (option && typeof option === "object") {
		                    myChart.setOption(option, true);
		                }


		                //饼图

		                var dom = document.getElementById("container2");
		                var myChart = echarts.init(dom);
		                var app = {};
		                option = null;
		                option = {
		                    title: {
		                        text: '告警数量占比',
		                        subtext: '本年',
		                        left: 'center'
		                    },
		                    color:['#ff7c7c','#5bc49f','#60acfc'],
		                    tooltip: {
		                        trigger: 'item',
		                        formatter: '{a} <br/>{b} : {c} ({d}%)'
		                    },
		                    legend: {
		                        orient: 'vertical',
		                        left: 'left',
		                        data: ['高级', '中级','正常']
		                    },
		                    series: [
		                        {
		                            name: '告警',
		                            type: 'pie',
		                            radius: '55%',
		                            center: ['50%', '60%'],
		                            data: [
		                                {value: gj, name: '高级数量'},
		                                {value: zj, name: '中级数量'},
		                                {value: zc, name: '正常数量'},

		                            ],
		                            emphasis: {
		                                itemStyle: {
		                                    shadowBlur: 10,
		                                    shadowOffsetX: 0,
		                                    shadowColor: 'rgba(0, 0, 0, 0.5)'
		                                }
		                            }
		                        }
		                    ]
		                };

		                if (option && typeof option === "object") {
		                    myChart.setOption(option, true);
		                }
		//折线

		                var dom = document.getElementById("container3");
		                var myChart = echarts.init(dom);
		                var app = {};
		                option = null;
		                option = {
		                    title: {
		                        text: '（本年）',

		                        left: 'left'
		                    },

		                    tooltip: {
		                        trigger: 'axis'
		                    },
		                    legend: {
		                        data: ['高级', '中级', '正常']
		                    },
		                    grid: {
		                        left: '3%',
		                        right: '4%',
		                        bottom: '3%',
		                        containLabel: true
		                    },
		                    toolbox: {
		                        feature: {
		                            saveAsImage: {}
		                        }
		                    },
		                    xAxis: {
		                        type: 'category',
		                        boundaryGap: false,
		                        data:  ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
		                    },
		                    yAxis: {
		                        type: 'value'
		                    },
		                    series: [
		                        {
		                            name: '高级',
		                            type: 'line',
		                            stack: '总量',
		                            data: gjsl
		                        },
		                        {
		                            name: '中级',
		                            type: 'line',
		                            stack: '总量',
		                            data:zjsl
		                        },
		                        {
		                            name: '正常',
		                            type: 'line',
		                            stack: '总量',
		                            data: zcsl
		                        },
		                    ]
		                };

		                if (option && typeof option === "object") {
		                    myChart.setOption(option, true);
		                }





		            },
		            error: function (jqXHR, textStatus, errorThrown) {
		            }
		        });


		    }









	</script>
</html>
